import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;

public class Main {
    private static boolean loop = true;

    public static void main(String[] args) {
        try {

            ServerSocket socket = new ServerSocket(8888);
            while (loop) {
                Socket accept = socket.accept();
                InputStreamReader reader = new InputStreamReader(accept.getInputStream());
                BufferedReader bufReader = new BufferedReader(reader);
                while (bufReader.ready()) {
                    System.out.println(bufReader.readLine());
                }
                OutputStreamWriter writer = new OutputStreamWriter(accept.getOutputStream());
                writer.write("receive chrome request.");
                writer.flush();
                accept.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}